package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.service.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;


@RestController
@RequestMapping("admin/config")
public class ConfigController {

    @Autowired
    ConfigService configService;

    @GetMapping("mall")
    public BaseRespVo mall(){
        return BaseRespVo.ok(configService.mall()) ;
    }
    @PostMapping("mall")
    public BaseRespVo mall(@RequestBody HashMap<String,String> map){
        configService.mall(map);
        return BaseRespVo.ok() ;
    }

    @GetMapping("express")
    public BaseRespVo express(){
        return BaseRespVo.ok(configService.express());
    }

    @PostMapping("express")
    public BaseRespVo express(@RequestBody HashMap<String,String> map){
        configService.express(map);
        return BaseRespVo.ok();
    }

    @GetMapping("order")
    public BaseRespVo order(){
        return BaseRespVo.ok(configService.order());
    }

    @PostMapping("order")
    public BaseRespVo order(@RequestBody HashMap<String,String> map){
        configService.order(map);
        return BaseRespVo.ok();
    }

    @GetMapping("wx")
    public BaseRespVo wx(){
        return BaseRespVo.ok(configService.wx());
    }

    @PostMapping("wx")
    public BaseRespVo wx(@RequestBody HashMap<String,String> map){
        configService.wx(map);
        return BaseRespVo.ok();
    }
}
